package com.geekca.homework;

import java.util.ArrayList;

public class TestMain {
    public static void main(String[] args) {
        // 创建usb设备列表
        ArrayList<Usb> usbList = new ArrayList<>();
        // 创建usb设备
        Usb usbController = new UsbController();
        Usb usbKeyboard = new UsbKeyboard();
        Usb usbMouse = new UsbMouse();
        Usb usbWifi = new UsbWifi();
        // 添加设备到列表
        usbList.add(usbWifi);
        usbList.add(usbKeyboard);
        usbList.add(usbMouse);
        usbList.add(usbController);
        // 创建电脑对象
        Computer computer = new Computer();
        // 遍历列表设备并执行方法
        for (int i = 0; i < usbList.size(); i++) {
            computer.connectAndDisconnect(usbList.get(i));
        }


    }
}
